<template>
  <div>
    <el-upload
        :action="u+'file?filePath='+fileName"
        list-type="picture-card"
        :auto-upload="true"
    :before-upload="handleUpdate">
      <i slot="default" class="el-icon-plus"></i>
      <div slot="file" slot-scope="{file}">
        <img
            class="el-upload-list__item-thumbnail"
            :src="file?.url" alt=""
        >
        <span class="el-upload-list__item-actions">

      </span>
      </div>
    </el-upload>
  </div>
</template>

<script setup>
import {reactive,ref,inject} from 'vue'
const url = inject("$baseURL").slice(0,-4)+'110/'
const u = ref(url)
const porps = defineProps(['type', "size"])
const file =reactive({
  url:"https://img0.baidu.com/it/u=3991283623,194749894&fm=253&fmt=auto&app=138&f=JPEG?w=260&h=260"
})
const fileName = ref("")
const $emit = defineEmits(['getName'])

const handleUpdate =(file)=>{

fileName.value = file.uid+file.name
  console.log(fileName)
  $emit('getName', fileName)
}




</script>

<style scoped>

</style>